package com.kpx.app.wigdet;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.kpx.app.R;
import com.kpx.app.bean.QDinfoBean;

/**
 * 签到
 * 陈聪
 */
public class QDshowDialog extends BaseDialog  {

    private final Context context;
    private TextView tvTitle;
    private TextView txtmg;
    private LinearLayout ll_show_qd_count;
    private TextView txt;

    public QDshowDialog(Context context) {
        super(context);
        this. context= context;
        setContent();
    }



    private void setContent() {
        setContentView(R.layout.dialog_qd_layout);
        tvTitle = (TextView) findViewById(R.id.title);
        txt = (TextView) findViewById(R.id.txt);
        ll_show_qd_count = (LinearLayout) findViewById(R.id.ll_show_qd_count);
        txtmg = (TextView) findViewById(R.id.mg);
    }

    public void setTitle(String title) {
        tvTitle.setText(title);
    }

    public void setMg(String mg) {
        txtmg.setText(mg);
    }


    public void setData(QDinfoBean b) {
        tvTitle.setText("今日签到+"+b.getScore());
        txt.setText(b.getSeriesCountDay()+"天");
        for (int i = 0; i < b.getDateStr().size(); i++) {
            View view = View.inflate(context,R.layout.qd_show_view,null);
            view.findViewById(R.id.txt_show_time).setBackgroundResource(b.getDateStr().get(i).getHasSign()==1?R.drawable.red_slide_shape:R.drawable.red_stoke_shape);
            ((TextView)view.findViewById(R.id.txt_show_time)).setTextColor(context.getResources().getColor(b.getDateStr().get(i).getHasSign()==1?R.color.white:R.color.black_3c));
            ((TextView)view.findViewById(R.id.txt_show_time)).setText(b.getDateStr().get(i).getScore()+"");
            ((TextView)view.findViewById(R.id.txt_show_time2)).setText(b.getDateStr().get(i).getDate()+"");
            ll_show_qd_count.addView(view);
        }
    }
}
